
use serde::{Deserialize, Serialize};
use chrono::{DateTime, Utc};

use crate::node::types::TaskType;

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename = "SectorID")]
pub struct SectorId {
    #[serde(rename(deserialize = "Miner"))]
    pub miner: u64,
    #[serde(rename(deserialize = "Number"))]
    pub number: u64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename = "CallID")]
pub struct CallId {
    #[serde(rename(deserialize = "ID"))]
    pub id: String,
    #[serde(rename(deserialize = "Sector"))]
    pub sector: SectorId,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct Job {
    #[serde(rename(deserialize = "ID"))]
    pub id: CallId,
    pub sector: SectorId,
    pub task: TaskType,
    pub run_wait: i32,
    pub start: DateTime<Utc>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct SectorStorageInfo {
    #[serde(rename(deserialize = "ID"))]
    pub id: String,
    #[serde(rename(deserialize = "URLs"))]
    pub urls: Vec<String>,
    pub weight: u64,
    pub can_sel: bool,
    pub can_store: bool,
    pub primary: bool,
}